package top.bulk.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import top.bulk.entity.UserEntity;

import javax.validation.Valid;
import javax.validation.constraints.Min;

/**
 * 测试在service层面直接校验参数的使用
 *
 * @author 散装java
 * @version 1.0.0
 * @date 2024-06-10
 */
@Service
@Slf4j
@Validated
public class UserService {
    public String get(@Min(value = 1L, message = "编号必须大于 0") Integer id) {
        log.info("[get][id: {}]", id);
        return "ok";
    }

    public void add(@Valid UserEntity user) {
        log.info("[add][user: {}]", user);
    }
}
